body {
  background: #f3f3f3;
}
@mixin center {
  display: flex;
  justify-content: center;
  align-items: center;
}
$color: #16a085;

:root {
  font-size: 15px;
}
hr {
  height: 1px;
  background-color: #ddd;
  border: none;
}
.navbar {
  @include center();
  padding: 1rem 0;
  background-color: #ffffff;

  & > .logo {
    @include center();
    color: $color;

    i.fa {
      font-size: 1.3rem;
      margin-right: 0.3rem;
    }
    span {
      font-size: 1.31rem;
      font-weight: bold;
    }
  }
  & > nav {
    margin-right: auto;
    @include center();
    margin-left: 1rem;
    a {
      text-decoration: none;
      font-size: 1.1rem;
      padding: 0 0.5rem;
      color: #333;
    }
  }
  & > .member {
    display: flex;
    & > .message {
      margin-right: 1rem;
      position: relative;
      @include center();
      i.fa {
        font-size: 1.3rem;
      }
      span {
        position: absolute;
        top: -0.5rem;
        left: -0.2rem;
        background-color: $color;
        color: white;
        padding: 0.1rem 0.3rem;
        font-size: 12px;
        border-radius: 0.2rem;
      }
    }
    & > .user {
      display: flex;
      cursor: pointer;
      position: relative;
      padding-right: 2rem;
      cursor: pointer;
      img {
        width: 1.5rem;
        height: 1.5rem;
        border-radius: 0.2rem;
        margin-right: 0.5rem;
      }
      .icon {
        label {
          @include center();
          cursor: pointer;

          i.fa {
            position: relative;
            margin-left: 0.3rem;
            top: -0.2rem;
          }
        }
      }
      input#toggle-menu:checked ~ nav {
        display: grid;
      }
      nav {
        position: absolute;
        display: none;
        grid-auto-flow: row;
        background-color: #ffff;
        border: solid 1px #ddd;
        right: 0;
        left: 0;
        top: 2rem;
        padding: 1rem 0;
        border-radius: 0.3rem;
        a {
          padding: 0.5rem 1rem;
          text-decoration: none;
          color: #333;
        }
      }
    }
  }
  & > .toggle-icon {
    @include center();
    display: none;
    position: absolute;
    border: solid 1px #ddd;
    width: 2.2rem;
    height: 2.2rem;
    font-size: 1.2rem;
    right: 1rem;
    top: 0.8rem;
    transition-duration: 0.5s;
  }
}

@media (max-width: 576px) {
  .navbar {
    justify-content: start;
    align-items: flex-start;
    padding-left: 1rem;
    flex-direction: column;

    & > nav {
      display: none;
      flex-direction: column;
      margin-left: 0;
      a {
        padding: 0.8rem 0 0;
      }
    }
    & > .member {
      display: none;
      flex-direction: column;
      margin-top: 1rem;

      & > .message {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 1rem;
        & > span {
          left: 1rem;
        }
      }
    }
    .toggle-icon {
      display: flex;
    }
    input#dropdown-menu:checked {
      & ~ nav {
        display: flex;
      }
      & ~ .member {
        display: flex;
      }
      & ~ .toggle-icon {
        border-radius: 50%;
        color: $color;
        border-color: $color;
        transform: rotate(720deg);
      }
    }
  }
}

@keyframes rotate-menu {
  to {
    transform: rotate(90deg);
  }
}
